.class public Lnbisdk/cg;
.super Ljava/lang/Object;

# interfaces
.implements Lnbisdk/qv;


# instance fields
.field private dJ:Landroid/content/Context;

.field private dK:Z


# direct methods
.method public constructor <init>()V
    .locals 0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Z)V
    .locals 1

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    iput-boolean v0, p0, Lnbisdk/cg;->dK:Z

    const/4 v0, 0x1

    iput-boolean v0, p0, Lnbisdk/cg;->dK:Z

    iput-object p1, p0, Lnbisdk/cg;->dJ:Landroid/content/Context;

    return-void
.end method


# virtual methods
.method public final b(Lnbisdk/sl;)Lnbisdk/kg;
    .locals 6
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/SecurityException;,
            Ljava/io/IOException;
        }
    .end annotation

    const/4 v5, 0x0

    iget-object v0, p0, Lnbisdk/cg;->dJ:Landroid/content/Context;

    const-string v1, "connectivity"

    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/net/ConnectivityManager;

    invoke-virtual {v0}, Landroid/net/ConnectivityManager;->getAllNetworkInfo()[Landroid/net/NetworkInfo;

    move-result-object v0

    if-eqz v0, :cond_5

    array-length v1, v0

    move v2, v5

    move v3, v5

    :goto_0
    if-ge v2, v1, :cond_2

    aget-object v4, v0, v2

    if-nez v3, :cond_0

    invoke-virtual {v4}, Landroid/net/NetworkInfo;->isConnected()Z

    move-result v3

    if-eqz v3, :cond_1

    :cond_0
    const/4 v3, 0x1

    :goto_1
    add-int/lit8 v2, v2, 0x1

    goto :goto_0

    :cond_1
    move v3, v5

    goto :goto_1

    :cond_2
    move v0, v3

    :goto_2
    if-nez v0, :cond_3

    new-instance v0, Ljava/net/UnknownHostException;

    const-string v1, "No network available"

    invoke-direct {v0, v1}, Ljava/net/UnknownHostException;-><init>(Ljava/lang/String;)V

    throw v0

    :cond_3
    iget-boolean v0, p0, Lnbisdk/cg;->dK:Z

    if-nez v0, :cond_4

    new-instance v0, Lnbisdk/lz;

    iget-object v1, p0, Lnbisdk/cg;->dJ:Landroid/content/Context;

    invoke-direct {v0, p1, v1}, Lnbisdk/lz;-><init>(Lnbisdk/sl;Landroid/content/Context;)V

    :goto_3
    return-object v0

    :cond_4
    new-instance v0, Lnbisdk/bu;

    invoke-direct {v0, p1}, Lnbisdk/bu;-><init>(Lnbisdk/sl;)V

    goto :goto_3

    :cond_5
    move v0, v5

    goto :goto_2
.end method
